package com.jincin.core.xsd;

import java.io.InputStream;
import java.io.InputStreamReader;

import org.exolab.castor.xml.ValidationException;

public class Demo {

	public static void main(String[] args) throws Exception, ValidationException {
		InputStream ins = ClassLoader.getSystemResourceAsStream("com/tl/xsd2/PageFrame.xml");
		InputStreamReader inr = new InputStreamReader(ins);
		
		String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><PageFrame xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"PageFrame.xsd\">	<Component Type=\"17\" Id=\"hightlightJS\">		<Param Id=\"index\" Value=\"5\"/>	</Component>	<Component Type=\"0\" Id=\"\" Class=\"wrap\">		<Component Type=\"1\" Id=\"header.htm\">			<Param Id=\"nPageId\" Value=\"1\"/>		</Component>		<Component Type=\"11\" Id=\"banner\"/>		<Component Type=\"0\" Id=\"\" Class=\"mian\">			<Component Type=\"13\" Id=\"menu.htm\">				<Param Id=\"nPageId\" Value=\"357\"/>			</Component>			<Component Type=\"0\" Id=\"\" Class=\"scheme_right\">				<Component Type=\"9\" Id=\"richcontent\"/>				<Component Type=\"18\" Id=\"stratagePartner\">					<Param Id=\"ListName\" Value=\"战略伙伴\"/>				</Component>			</Component>			<Component Type=\"0\" Id=\"clear\" Class=\"clear\"/>		</Component>		<Component Type=\"7\" Id=\"footer.htm\">			<Param Id=\"nPageId\" Value=\"2\"/>		</Component>	</Component></PageFrame>";
//		PageFrame pf = PageFrame.unmarshal(inr);
		PageFrame pf = PageFrame.fromXML(xml);
		PageFrameItem[] pageFrameItem = pf.getPageFrameItem();
		for(PageFrameItem p: pageFrameItem){
			Component component = p.getComponent();
		}
	}
}
